package cn.gson.crm.model.pojos;

import javafx.scene.DepthTest;

import javax.persistence.*;
import javax.xml.crypto.Data;
import java.sql.Time;
import java.util.Date;
import java.util.Objects;

@Entity
@Table(name = "SALES_AT", schema = "CRM", catalog = "")
public class SalesAt {
    private long salesId;
    private Date salesTime;
    private Long salesValue;
    private Long salesAccomplish;
    private String salesRemarks;
    private Long salesDepartment;
    private Employee employeeByYgId;//员工

    @Id
    @Column(name = "SALES_ID", nullable = false, precision = 0)
    @GeneratedValue(generator  =  "seq",strategy  =  GenerationType.SEQUENCE)
    //定义一个序列生成器
    @SequenceGenerator(name  =  "seq",sequenceName  =  "crm",
            initialValue  =  1,allocationSize  =  1)
    public long getSalesId() {
        return salesId;
    }

    public void setSalesId(long salesId) {
        this.salesId = salesId;
    }

    @Basic
    @Column(name = "SALES_TIME", nullable = true)
    public Date getSalesTime() {
        return salesTime;
    }

    public void setSalesTime(Date salesTime) {
        this.salesTime = salesTime;
    }

    @Basic
    @Column(name = "SALES_VALUE", nullable = true, precision = 0)
    public Long getSalesValue() {
        return salesValue;
    }

    public void setSalesValue(Long salesValue) {
        this.salesValue = salesValue;
    }


    @Basic
    @Column(name = "SALES_ACCOMPLISH", nullable = true, precision = 0)
    public Long getSalesAccomplish() {
        return salesAccomplish;
    }

    public void setSalesAccomplish(Long salesAccomplish) {
        this.salesAccomplish = salesAccomplish;
    }

    @Basic
    @Column(name = "SALES_REMARKS", nullable = true, length = 200)
    public String getSalesRemarks() {
        return salesRemarks;
    }

    public void setSalesRemarks(String salesRemarks) {
        this.salesRemarks = salesRemarks;
    }

    @Basic
    @Column(name = "SALES_DEPARTMENT", nullable = true, precision = 0)
    public Long getSalesDepartment() {
        return salesDepartment;
    }

    public void setSalesDepartment(Long salesDepartment) {
        this.salesDepartment = salesDepartment;
    }

    @ManyToOne
    @JoinColumn(name = "yg_id", referencedColumnName = "yg_id")
    public Employee getEmployeeByYgId() {
        return employeeByYgId;
    }

    public void setEmployeeByYgId(Employee employeeByYgId) {
        this.employeeByYgId = employeeByYgId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SalesAt salesAt = (SalesAt) o;
        return salesId == salesAt.salesId &&
                Objects.equals(salesTime, salesAt.salesTime) &&
                Objects.equals(salesValue, salesAt.salesValue) &&
                Objects.equals(salesAccomplish, salesAt.salesAccomplish) &&
                Objects.equals(salesRemarks, salesAt.salesRemarks) &&
                Objects.equals(salesDepartment, salesAt.salesDepartment);
    }

    @Override
    public int hashCode() {
        return Objects.hash(salesId, salesTime, salesValue, salesAccomplish, salesRemarks, salesDepartment);
    }
}
